-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New action: aws_cloudfront_create_invalidation
#43955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
aws_cloudfront_create_invalidation
b1b9d8b to
1c43cb1
Compare
|
Test account permissions have been updated so that I can no longer test this action... |
|
And, I have permission again. After all the rebases: % make t T=TestAccCloudFrontCreateInvalidationAction_basic K=cloudfront
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-cloudfront-invalidate-cache-action 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run='TestAccCloudFrontCreateInvalidationAction_basic' -timeout 360m -vet=off
2025/09/17 11:18:06 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/17 11:18:06 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN TestAccCloudFrontCreateInvalidationAction_basic
=== PAUSE TestAccCloudFrontCreateInvalidationAction_basic
=== CONT TestAccCloudFrontCreateInvalidationAction_basic
--- PASS: TestAccCloudFrontCreateInvalidationAction_basic (488.95s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 494.414s |
jar-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
% TF_ACC_TERRAFORM_PATH=/Users/jaredbaker/go/bin/terraform make t K=cloudfront T=TestAccCloudFrontCreateInvalidationAction_basic
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-cloudfront-invalidate-cache-action 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run='TestAccCloudFrontCreateInvalidationAction_basic' -timeout 360m -vet=off
2025/09/17 13:34:36 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/17 13:34:36 Initializing Terraform AWS Provider (SDKv2-style)...
--- PASS: TestAccCloudFrontCreateInvalidationAction_basic (454.63s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 461.275s| if !regexache.MustCompile(`^(/.*|\*)$`).MatchString(path) { | ||
| resp.Diagnostics.AddError( | ||
| "Invalid Path Format", | ||
| fmt.Sprintf("Path '%s' must start with '/' or be '*' for all files", path), | ||
| ) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but may be nice to write a custom type to handle this validation in the future.
|
Warning This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
|
This functionality has been released in v6.14.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Description
Since these actions may be merged in bulk, extra checklist to help:
terraform_datatriggerwebsite/docs/actions/fileregionpattern (framework.WithRegionModel) (N/A, global resource)This PR introduces a new Terraform action that allows users to invalidate a CloudFront distribution cache for specified paths. The action creates an invalidation request via the AWS CloudFront API and waits for it to complete, providing real-time progress updates throughout the process. Users can specify individual files, directory wildcards, or invalidate all cached content, with configurable timeouts and optional caller references for tracking.
The action is designed for common CI/CD workflows where cache invalidation is needed after deploying updated static assets. It integrates seamlessly with terraform_data lifecycle triggers, enabling automatic cache invalidation during infrastructure updates. The implementation includes comprehensive validation, error handling for CloudFront-specific scenarios (like too many concurrent invalidations), and follows the established AWS provider patterns for actions with proper documentation and acceptance tests.
Relations
aws_lambda_invoke#43972aws_cloudfront_create_invalidation#43955 (this)aws_ses_send_email#44214aws_sns_publish#44232aws_ec2_stop_instance#43700References
Output from Acceptance Testing